<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Gadget3D.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - Gadget 3D
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<b><font color="#3A3966">IncludeFile</font></b> <font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Screen3DRequester.pb"

<b><font color="#3A3966">Define</font></b>.f KeyX, KeyY, MouseX, MouseY

<b><font color="#3A3966">Enumeration</font></b> <font color="#3A3966">; Window3D
</font>  <font color="#924B72">#MainWindow</font>
  <font color="#924B72">#SecondWindow</font>
<b><font color="#3A3966">EndEnumeration</font></b>


<b><font color="#3A3966">Enumeration</font></b> <font color="#3A3966">; Gadget3D
</font>  <font color="#924B72">#ActiveWindowLabel</font>
  <font color="#924B72">#CloseButton</font>
  <font color="#924B72">#ProgressBar</font>
  <font color="#924B72">#ComboBox</font>
  <font color="#924B72">#Panel</font>
  <font color="#924B72">#ListView</font>
  <font color="#924B72">#Image</font>
  <font color="#924B72">#Image2</font>
  <font color="#924B72">#ScrollArea</font>
  <font color="#924B72">#ScrollBar</font>
  <font color="#924B72">#String</font>
  <font color="#924B72">#Spin</font>
  <font color="#924B72">#Container</font>
  <font color="#924B72">#CheckBox</font>
  <font color="#924B72">#Editor</font>
  <font color="#924B72">#Option1</font>
  <font color="#924B72">#Option2</font>
  <font color="#924B72">#Option3</font>
  <font color="#924B72">#Button</font>
<b><font color="#3A3966">EndEnumeration</font></b>

<b><font color="#3A3966">If</font></b> <font color="#3A3966">InitEngine3D</font>()

<font color="#3A3966">  Add3DArchive</font>(<font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Data", <font color="#924B72">#PB_3DArchive_FileSystem</font>)
<font color="#3A3966">  Add3DArchive</font>(<font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Data/Textures", <font color="#924B72">#PB_3DArchive_FileSystem</font>)
<font color="#3A3966">  Add3DArchive</font>(<font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Data/GUI", <font color="#924B72">#PB_3DArchive_FileSystem</font>)
<font color="#3A3966">  Add3DArchive</font>(<font color="#924B72">#PB_Compiler_Home</font> + "examples/3d/Data/Packs/desert.zip", <font color="#924B72">#PB_3DArchive_Zip</font>)
    
<font color="#3A3966">  InitSprite</font>()
<font color="#3A3966">  InitKeyboard</font>()
<font color="#3A3966">  InitMouse</font>()
  
  <b><font color="#3A3966">If</font></b> <font color="#3A3966">Screen3DRequester</font>()
    
<font color="#3A3966">    SkyBox</font>("desert07.jpg")
		
<font color="#3A3966">		CreateCamera</font>(0, 0, 0, 100, 100)  <font color="#3A3966">; Front camera
</font><font color="#3A3966">    MoveCamera</font>(0, 0, 0, 100, <font color="#924B72">#PB_Absolute</font>)
    
<font color="#3A3966">    OpenWindow3D</font>(<font color="#924B72">#MainWindow</font>, 50, 20, 280, 400, "Hello in 3D !", <font color="#924B72">#PB_Window3D_SizeGadget</font>)
		
    Top = 10
<font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#ActiveWindowLabel</font>, 10, Top, 250, 25, "Active window: ") : Top + 30
    
    <font color="#3A3966">;- ProgressBar
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "Progress bar: ")
<font color="#3A3966">    ProgressBarGadget3D</font>(<font color="#924B72">#ProgressBar</font>, 110, Top, 150, 25, 0, 100) : Top + 30
<font color="#3A3966">    SetGadgetState3D</font>(<font color="#924B72">#ProgressBar</font>, 30)
<font color="#3A3966">    GadgetToolTip3D</font>(<font color="#924B72">#ProgressBar</font>, "I'm a progress bar")
    
    <font color="#3A3966">;- ComboBox
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "Combo box: ")
<font color="#3A3966">    ComboBoxGadget3D</font>(<font color="#924B72">#ComboBox</font>, 110, Top, 150, 25) : Top + 30
<font color="#3A3966">    GadgetToolTip3D</font>(<font color="#924B72">#ComboBox</font>, "Combobox tooltip !")
<font color="#3A3966">    AddGadgetItem3D</font>(<font color="#924B72">#ComboBox</font>, -1, "Item 1")
<font color="#3A3966">    AddGadgetItem3D</font>(<font color="#924B72">#ComboBox</font>, -1, "Item 2")
<font color="#3A3966">    AddGadgetItem3D</font>(<font color="#924B72">#ComboBox</font>, -1, "Item 3")
<font color="#3A3966">    AddGadgetItem3D</font>(<font color="#924B72">#ComboBox</font>, -1, "Item 4")
    
     <font color="#3A3966">;- ScrollBar
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "Scroll bar: ")
<font color="#3A3966">    ScrollBarGadget3D</font>(<font color="#924B72">#ScrollBar</font>, 110, Top+7, 150, 10, 0, 100, 20) : Top + 30
<font color="#3A3966">    SetGadgetState3D</font>(<font color="#924B72">#ScrollBar</font>, 30)
        
    <font color="#3A3966">;- String
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "String: ")
<font color="#3A3966">    StringGadget3D</font>(<font color="#924B72">#String</font>, 110, Top, 150, 25, "Modify me") : Top + 30
<font color="#3A3966">    GadgetToolTip3D</font>(<font color="#924B72">#String</font>, "I'm a string gadget")
    
    <font color="#3A3966">;- CheckBox
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "Check box: ")
<font color="#3A3966">    CheckBoxGadget3D</font>(<font color="#924B72">#CheckBox</font>, 110, Top, 150, 25, "Enable something") : Top + 30
<font color="#3A3966">    GadgetToolTip3D</font>(<font color="#924B72">#CheckBox</font>, "I'm a checkbox !")
<font color="#3A3966">    SetGadgetState3D</font>(<font color="#924B72">#CheckBox</font>, 1)
    
    <font color="#3A3966">;- Spinner
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "Spinner: ")
<font color="#3A3966">    SpinGadget3D</font>(<font color="#924B72">#Spin</font>, 110, Top, 150, 25, 0, 100) : Top + 30
<font color="#3A3966">    GadgetToolTip3D</font>(<font color="#924B72">#Spin</font>, "I'm a spinner !")
    
    <font color="#3A3966">;- Options
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "Options: ")
<font color="#3A3966">    OptionGadget3D</font>(<font color="#924B72">#Option1</font>, 110, Top, 150, 25, "Choice 1") : Top + 30
<font color="#3A3966">    OptionGadget3D</font>(<font color="#924B72">#Option2</font>, 110, Top, 150, 25, "Choice 2") : Top + 30
<font color="#3A3966">    OptionGadget3D</font>(<font color="#924B72">#Option3</font>, 110, Top, 150, 25, "Choice 3") : Top + 30
<font color="#3A3966">    GadgetToolTip3D</font>(<font color="#924B72">#Option1</font>, "I'm option 1 !")
<font color="#3A3966">    SetGadgetState3D</font>(<font color="#924B72">#Option2</font>, 1)
    
    <font color="#3A3966">;- Button
</font><font color="#3A3966">    TextGadget3D</font>(<font color="#924B72">#PB_Any</font>, 10, Top, 100, 25, "Button: ")
<font color="#3A3966">    ButtonGadget3D</font>(<font color="#924B72">#Button</font>, 110, Top, 150, 25, "Click me !") : Top + 30
<font color="#3A3966">    GadgetToolTip3D</font>(<font color="#924B72">#Button</font>, "I'm a button !")
        

<font color="#3A3966">    OpenWindow3D</font>(<font color="#924B72">#SecondWindow</font>, 400, 150, 400, 400, "More gadgets", <font color="#924B72">#PB_Window3D_SizeGadget</font>)
    
<font color="#3A3966">    PanelGadget3D</font>(<font color="#924B72">#Panel</font>, 10, 10, 370, 350)
<font color="#3A3966">      GadgetToolTip3D</font>(<font color="#924B72">#Panel</font>, "Panel tooltip !")
<font color="#3A3966">      AddGadgetItem3D</font>(<font color="#924B72">#Panel</font>, -1, "First")
<font color="#3A3966">        ListViewGadget3D</font>(<font color="#924B72">#ListView</font>, 10, 10, 200, 200, <font color="#924B72">#PB_ListView3D_Multiselect</font>)
          <b><font color="#3A3966">For</font></b> k = 0 <b><font color="#3A3966">To</font></b> 20
<font color="#3A3966">            AddGadgetItem3D</font>(<font color="#924B72">#ListView</font>, -1, "Item "+<font color="#3A3966">Str</font>(k))
          <b><font color="#3A3966">Next</font></b>
          
<font color="#3A3966">      AddGadgetItem3D</font>(<font color="#924B72">#Panel</font>, -1, "Second")
<font color="#3A3966">        ContainerGadget3D</font>(<font color="#924B72">#Container</font>, 0, 0, 400, 400)
<font color="#3A3966">          GadgetToolTip3D</font>(<font color="#924B72">#Container</font>, "Container tooltip !")
      
<font color="#3A3966">          LoadTexture</font>(0, "clouds.jpg")
<font color="#3A3966">          ImageGadget3D</font>(<font color="#924B72">#Image</font>, 10, 10, 128, 128,<font color="#3A3966"> TextureID</font>(0))
      
<font color="#3A3966">          ScrollAreaGadget3D</font>(<font color="#924B72">#ScrollArea</font>, 10, 150, 100, 100, 256, 256, 30)
<font color="#3A3966">          GadgetToolTip3D</font>(<font color="#924B72">#ScrollArea</font>, "Scroll area tooltip !")
<font color="#3A3966">            ImageGadget3D</font>(<font color="#924B72">#Image2</font>, 10, 10, 256, 256,<font color="#3A3966"> TextureID</font>(0))
<font color="#3A3966">          CloseGadgetList3D</font>()
        
<font color="#3A3966">        CloseGadgetList3D</font>()
    
<font color="#3A3966">      AddGadgetItem3D</font>(<font color="#924B72">#Panel</font>, -1, "Third")
<font color="#3A3966">        EditorGadget3D</font>(<font color="#924B72">#Editor</font>, 10, 10, 300, 200)
<font color="#3A3966">        SetGadgetText3D</font>(<font color="#924B72">#Editor</font>, "Multi" + <font color="#924B72">#LF$</font> + "Line" + <font color="#924B72">#LF$</font> + "Editor !")
      
<font color="#3A3966">    CloseGadgetList3D</font>()
    
    <b><font color="#3A3966">Repeat</font></b>
<font color="#3A3966">      Screen3DEvents</font>()
      
      <b><font color="#3A3966">If</font></b> <font color="#3A3966">ExamineKeyboard</font>() <b><font color="#3A3966">And</font></b> <font color="#3A3966">ExamineMouse</font>()
        Input$ =<font color="#3A3966"> KeyboardInkey</font>()
        
        SpecialKey = 0
        <b><font color="#3A3966">If</font></b>     <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Back</font>)   :  SpecialKey = <font color="#924B72">#PB_Key_Back</font>
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Return</font>) : SpecialKey = <font color="#924B72">#PB_Key_Return</font>
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Left</font>)   : SpecialKey = <font color="#924B72">#PB_Key_Left</font>
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Right</font>)  : SpecialKey = <font color="#924B72">#PB_Key_Right</font>
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Up</font>)     : SpecialKey = <font color="#924B72">#PB_Key_Up</font>
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Down</font>)   : SpecialKey = <font color="#924B72">#PB_Key_Down</font>
        <b><font color="#3A3966">ElseIf</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Delete</font>) : SpecialKey = <font color="#924B72">#PB_Key_Delete</font>
        <b><font color="#3A3966">EndIf</font></b>
        
<font color="#3A3966">        InputEvent3D</font>(<font color="#3A3966">MouseX</font>(),<font color="#3A3966"> MouseY</font>(),<font color="#3A3966"> MouseButton</font>(<font color="#924B72">#PB_MouseButton_Left</font>), Input$, SpecialKey)
      <b><font color="#3A3966">EndIf</font></b>
      
      <font color="#3A3966">; Handle the GUI 3D events, it's similar to regular GUI events
</font>      <font color="#3A3966">;
</font>      <b><font color="#3A3966">Repeat</font></b>
      	Event =<font color="#3A3966"> WindowEvent3D</font>()
      	
<font color="#3A3966">      	SetGadgetText3D</font>(<font color="#924B72">#ActiveWindowLabel</font>, "Active #Window3D: "+<font color="#3A3966">Str</font>(<font color="#3A3966">GetActiveWindow3D</font>()))
      	
	<b><font color="#3A3966">Select</font></b> Event
      		<b><font color="#3A3966">Case</font></b> <font color="#924B72">#PB_Event3D_Gadget</font>
      		  <b><font color="#3A3966">If</font></b> <font color="#3A3966">EventGadget3D</font>() = <font color="#924B72">#CloseButton</font>
<font color="#3A3966">      		    CloseWindow3D</font>(<font color="#924B72">#MainWindow</font>)
      		  <b><font color="#3A3966">EndIf</font></b>
      			
	<b><font color="#3A3966">EndSelect</font></b>
      <b><font color="#3A3966">Until</font></b> Event = 0
      
<font color="#3A3966">      RenderWorld</font>()
      
<font color="#3A3966">      FlipBuffers</font>()
    <b><font color="#3A3966">Until</font></b> <font color="#3A3966">KeyboardPushed</font>(<font color="#924B72">#PB_Key_Escape</font>) <b><font color="#3A3966">Or</font></b> Quit = 1
  <b><font color="#3A3966">EndIf</font></b>
    
<b><font color="#3A3966">Else</font></b>
<font color="#3A3966">  MessageRequester</font>("Error", "The 3D Engine can't be initialized",0)
<b><font color="#3A3966">EndIf</font></b>
</font></pre>
</body></html>
